package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

public interface UserMapper {

    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid} ")
    User selectById(String openid);

    /**
     * 新增用户
     * @param newUser
     */
    void save(User newUser);

    /**
     * 根据主键id查用户
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    /**
     * 用户数量统计
     * @param beginTime
     * @param endTime
     * @return
     */
    Integer selectCount(LocalDateTime beginTime, LocalDateTime endTime);
}
